<?php

namespace App\Http\Controllers\Seller;

use App\Repositories\Contracts\ShopRepositoryInterface;
use Illuminate\Http\Request;

class DealController extends BaseController
{
    protected $shopRepository;

    public function __construct(Request $request, ShopRepositoryInterface $shopRepository)
    {
        parent::__construct($request);
        $this->assign(['sideMenu' => 'deal']);
        $this->shopRepository = $shopRepository;
    }

    public function index(Request $request)
    {

        return $this->view('seller.deal.index', ['shop' => $this->shop]);
    }

    /**
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function update(Request $request)
    {
        $this->shop->update($request->except('shop_id', 'uid'));
        $this->shop->fresh();
        return ajaxReturn(['shop' => $this->shop]);
    }

    /**
     * @return \Illuminate\Http\JsonResponse
     */
    public function getShop()
    {
        return ajaxReturn(['shop' => $this->shop]);
    }

    public function day(Request $request){
        return $this->view('seller.deal.day', ['shop' => $this->shop]);
    }
}
